package main;
	
import java.awt.Dimension;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.chrono.ChronoLocalDate;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;

import manager.LoginManager;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.DatePicker;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;


public class Main extends Application {
	
	
	@Override
	public void start(Stage primaryStage) {
		try {
			Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
			int hauteur = (int)tailleEcran.getHeight();
			int largeur = (int)tailleEcran.getWidth();
			
			System.out.println("H :"+hauteur);
			System.out.println("L :"+largeur);
			BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("../frxml/Login.fxml"));
			//Scene scene = new Scene(root,largeur,hauteur);
			Scene scene = new Scene(root,1245,700);
			scene.getStylesheets().add(getClass().getResource("../css/Login.css").toExternalForm());
			
//			
			primaryStage.setScene(scene);
			primaryStage.setResizable(false);
			primaryStage.setTitle("GEstion des Ventes et Achats");
			
			primaryStage.show();
			
			DatePicker datePicker = new DatePicker();
			LocalDate isoDate = datePicker.getValue();
			ChronoLocalDate chronoDate =
			     ((isoDate != null) ? datePicker.getChronology().date(isoDate) : null);
			System.out.println("Selected date: " + chronoDate);
			LoginManager loginManager = new LoginManager(scene);
			loginManager.afficherAuthentification();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		launch(args);
	}
}
